package com.fr.report.script.core.parser;

import com.fr.base.ColumnRow;
import com.fr.report.script.Calculator;
import com.fr.report.script.core.ExTool;

public class ColumnRowRange extends Tiny
{
  private ColumnRowLiteral from;
  private ColumnRowLiteral to;
  private transient String toString;

  public static ColumnRowRange columnRow2Range(ColumnRow paramColumnRow)
  {
    ColumnRowLiteral localColumnRowLiteral = new ColumnRowLiteral(paramColumnRow, null, null, null, null, null);
    return new ColumnRowRange(localColumnRowLiteral, null);
  }

  ColumnRowRange(ColumnRowLiteral paramColumnRowLiteral1, ColumnRowLiteral paramColumnRowLiteral2)
  {
    this.from = paramColumnRowLiteral1;
    this.to = paramColumnRowLiteral2;
  }

  public ColumnRowLiteral getFrom()
  {
    return this.from;
  }

  public ColumnRowLiteral getTo()
  {
    return this.to;
  }

  public Object eval(Calculator paramCalculator)
    throws UtilEvalError
  {
    return paramCalculator.resolveVariable(this);
  }

  public String exString(Calculator paramCalculator)
  {
    Object localObject = paramCalculator.getAttribute(ExTool.TAG);
    if (localObject instanceof ExTool)
      return ((ExTool)localObject).ex(this);
    return toString();
  }

  public String toString()
  {
    if (this.toString == null)
    {
      StringBuffer localStringBuffer = new StringBuffer().append(this.from);
      if (this.to != null)
        localStringBuffer.append(":").append(this.to);
      this.toString = localStringBuffer.toString();
    }
    return this.toString;
  }

  public String getExpression(int paramInt1, int paramInt2, int paramInt3, int paramInt4, boolean paramBoolean)
  {
    return this.from.getExpression(paramInt1, paramInt2, paramInt3, paramInt4, paramBoolean) + ((this.to != null) ? ":" + this.to.getExpression(paramInt1, paramInt2, paramInt3, paramInt4, paramBoolean) : "");
  }

  public String[] parserParameter()
  {
    if (this.to == null)
      return new String[] { this.from.getParameterName() };
    return new String[] { this.from.getParameterName(), this.to.getParameterName() };
  }
}